<?php

/**
 * Pessoa form base class.
 *
 * @method Pessoa getObject() Returns the current form's model object
 *
 * @package    tcc
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePessoaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'contato_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contato'), 'add_empty' => true)),
      'nome'            => new sfWidgetFormInputText(),
      'data_nascimento' => new sfWidgetFormInputText(),
      'estadocivil'     => new sfWidgetFormInputText(),
      'cpf'             => new sfWidgetFormInputText(),
      'rg'              => new sfWidgetFormInputText(),
      'endereco_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Endereco'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'contato_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contato'), 'required' => false)),
      'nome'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'data_nascimento' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'estadocivil'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cpf'             => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'rg'              => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'endereco_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Endereco'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('pessoa[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pessoa';
  }

}
